﻿<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<head>
<title>消息列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<%=request.getContextPath()%>/style/adminStyle.css" rel="stylesheet" type="text/css" />
<script src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script src="<%=request.getContextPath()%>/js/public.js"></script>
<script type="text/javascript">



function selet(){
	var i=1;
if(Form.id.value==""|Form.id.value==null){
	
	 i=0;	
}
if(i==0){
	 alert("条件不能为空");
	 Form.coent.focus();
	 return false;
}else{
	
	if(Form.id.value.length>10){
		alert("查询条件不正确");
		 return false;
	}
	
	
	if(/.*[\u4e00-\u9fa5]+.*$/.test(Form.id.value)){ 
		alert("不能含有汉字！"); 
		return false; 
		} 
	return true;
}


	
}
</script>
</head>
<body >
	<div class="wrap">
		<div class="page-title">
			<span class="modular fl"><i class="order"></i><em>消息列表</em></span>
		</div>
		<div class="operate">
			<form action="../Administrators/basic_list2.do"  name="Form">
				<img src="../images/icon_search.gif" /> <input type="text" 
					class="textBox length-long" placeholder="输入ID..." id="id" name="id"/> 
					<input type="submit" value="查询" class="tdBtn" onclick="return selet()"/>
			</form>
		</div>
		<table class="list-style Interlaced">
			<tr>
				<th>id</th>
				<th>更新时间</th>
				<th>更新版本</th>
				<th>更新内容</th>
				<th>是否发布</th>
				<th>操作</th>
				
			</tr>
			
		      <c:if test="${vs!=null}">
				<tr>
				
					<td align="center">${vs.id}</td>
					<td class="center"><span class="block">${fn:substring(vs.updatetime, 0, 19)}</span></td>
					<td align="center" >${vs.version}</td>
					<td width="200"><span class="block" align="center">${vs.content}</span></td>
				
				
					<c:if test="${vs.make==0}">
						<td class="center"><span>未发布</span></td>
					</c:if>
					<c:if test="${vs.make==1}">
						<td class="center"><span>已发布</span></td>
					</c:if>
					
					<td class="center"><a href="<%=request.getContextPath()%>/Administrators/basic_up.do?id=${vs.id}"
						class="inline-block" title="编辑" onclick="javascript:return upse();"><img src="../images/icon_view.gif" /></a> 
							<a href="#" class="inline-block" onclick="javascript:return del(${vs.id});"	title="删除消息"><img src="<%=request.getContextPath()%>/images/icon_trash.gif"/></a>
							
					</td>
				</tr>
			</c:if>
	  
		</table>

	
	</div>
<script type="text/javascript">
   function upse(){
	   var sr=${admin.jurisdiction};
	   if(sr==1){
		   alert("权限不足");
			return false;
	   }else{
			return true;
	   }
	   
	   
}
function del(id) {
	
	var msg = "您确定要删除吗？\n\n请确认！";
	
	 var sr=${admin.jurisdiction};
	 if(sr==1){
		 alert("权限不足");
		return false;
	 }else{
			if(confirm(msg)==true){
				$.ajax({
					"url":"${pageContext.request.contextPath}/Administrators/basic_delete.do",
					"data":"id="+id,
					"type":"POST",
					"dataType":"json",
					"success":function(obj){

						if(obj.state==1){
							 alert("删除成功");
							window.location="${pageContext.request.contextPath}/Administrators/basic_list.do";
						}else{
							 alert("删除失败");
						}
				
					}});
				
			return true;
			}else{
			return false;
			}
		 
	 }
	

	}
</script>

</body>

</html>